package com.szu.subject.domains;

import java.util.ArrayList;
import java.util.List;

/**
 * 选课情况
 * 
 * @author Shenxiaolin
 *
 */
public class Selection extends BaseModel {

	private Long studentId;
	private Double credit;//学生可用学分，总学分-已选学分
	private List<CourseInfo> courseInfos;

	private Boolean operationType;//操作类型,true为选课，false为退课
	public Long getStudentId() {
		return studentId;
	}

	public void setStudentId(Long studentId) {
		this.studentId = studentId;
	}

	public List<CourseInfo> getCourseInfos() {
		return courseInfos;
	}

	public void setCourseInfos(List<CourseInfo> courseInfos) {
		this.courseInfos = courseInfos;
	}

	public Boolean getOperationType() {
		return operationType;
	}

	public void setOperationType(Boolean operationType) {
		this.operationType = operationType;
	}
	

	public void addCourseInfo(CourseInfo courseInfo){
		if(courseInfos==null){
			courseInfos=new ArrayList<>(10);
		}
		courseInfos.add(courseInfo);
	}
	
	public Double getSumCredit(){
		Double credit=0d;
		for(CourseInfo courseInfo:courseInfos){
			credit+=courseInfo.getCredit();
		}
		return credit;
	}

	public Double getCredit() {
		return credit;
	}

	public void setCredit(Double credit) {
		this.credit = credit;
	}

	

	
}
